package com.xzit.rcpyxt.controller;

import com.xzit.rcpyxt.constant.MessageCode;
import com.xzit.rcpyxt.dto.ClassDto;
import com.xzit.rcpyxt.dto.ResultModel;
import com.xzit.rcpyxt.dto.TeacherClassListRequest;
import com.xzit.rcpyxt.dto.TeacherDto;
import com.xzit.rcpyxt.service.ClassService;
import com.xzit.rcpyxt.utils.PageUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/class")
public class ClassController {

    @Autowired
    private ClassService classService;
    @ApiOperation(hidden = true, value = "获取所有班级")
    @RequestMapping(value = "/findClassList", method = RequestMethod.GET)
    public ResultModel findByClassList(ClassDto classDto) {
        PageUtil byClassList = classService.findByClassList(classDto);
        return new ResultModel(MessageCode.OK, byClassList);
    }

    /**
     * 获取老师管理的班级列表
     * @return
     */
    @ApiOperation(value = "获取老师管理的班级列表")
    @RequestMapping(value = "/findTeacherClassList", method = RequestMethod.GET)
    public ResultModel findTeacherClassList(TeacherClassListRequest teacherClassListRequest) {
        PageUtil byClassList = classService.findByTeacherClassList(teacherClassListRequest);
        return new ResultModel(MessageCode.OK, byClassList);
    }

}